# Spring推荐的Liberica Open JDK https://bell-sw.com/pages/downloads/
# bellsoft/liberica-openjdk-debian:17.0.13-cds
FROM bellsoft/liberica-openjdk-debian:21.0.5-cds

# 添加镜像维护者信息
LABEL maintainer="MoNaiHui"

# 设置时区和 JVM 的自定义配置选项
ENV TZ=Asia/Shanghai \
    JAVA_XMS="-Xms256m" \
    JAVA_XMX="-Xmx512m" \
    JAVA_GC="-XX:+UseG1GC" \
    JAVA_EGD="-Djava.security.egd=file:/dev/./urandom" \
    SERVER_PORT=8848

# 设置工作目录为 /apex
WORKDIR /apex

# 复制目标目录下的应用程序 JAR 文件到容器中的 /app 目录
COPY ./target/apex-nacos.jar /apex/app.jar

# 暴露容器的端口
EXPOSE ${SERVER_PORT} 7848 9848

# 启动应用程序
CMD ["sh", "-c", "java ${JAVA_XMS} ${JAVA_XMX} ${JAVA_GC} ${JAVA_EGD} -jar /apex/app.jar"]